package com.qcu.controller.staff;

import com.qcu.annotation.LimitRate;
import com.qcu.annotation.RequireAuthorization;
import com.qcu.service.ArchiveService;
import com.qcu.util.Response;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * @Name: MyComputer
 * @ClassName RiskController
 * @Description:
 * @date 2025/2/7 15:16
 */

@RestController
@RequestMapping("/staff/risk")
public class RiskController {
    @Resource
    ArchiveService archiveService;

    /**
     * 导出所有风险信息
     * @param response
     * @return
     */
    @GetMapping("/export")
//    @LimitRate(key = "getExport",permitsPerSecond = 2,expire = 10,msg = "八嘎雅鹿，你滴点那么快滴干什么滴干活...")
    public Response export(HttpServletResponse response) {

        //todo: 导出到excel
        archiveService.export(response);
        return Response.success();
    }

    /**
     * 获取所有风险信息
     * @return
     */
    @GetMapping("/all")
    @LimitRate(key = "getRiskInfo",permitsPerSecond = 2,expire = 10,msg = "八嘎雅鹿，你滴点那么快滴干什么滴干活...")
    @RequireAuthorization({"STAFF","PLAIN"})
    public Response getAll() {
        return archiveService.getAllRisk();
    }

}
